package com.dwxt.cdms.entity;

import com.dwxt.cdms.util.DictUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.time.LocalDateTime;

@Data
@Accessors(chain = true)
@Table(name = "t_equipment")
public class Equipment {

    @Id
    private String id;

    /**
     * 设备类别;关联数据字典【category】
     */
    private String category;

    /**
     * 设备类别前端显示
     */
    public String getCategoryDisplay(){
        return category==null?null: DictUtil.getDisplay("category",category);
    }

    /**
     * 设备名称
     */
    private String name;

    /**
     * 设备序列号
     */
    @Column(name = "serial_number")
    private String serialNumber;

    /**
     * 设备参数
     */
    private String parameter;

    /**
     * 发放状态;关联数据字典【distributionStatus】
     */
    @Column(name = "distribution_status")
    private String type;

    /**
     * 发放状态 前端显示
     */
    public String getTypeDisplay(){
        return type==null?null: DictUtil.getDisplay("distributionStatus",type);
    }

    /**
     * 归档人(当前登录用户的id)
     */
    @Column(name = "archivist_id")
    private Integer archivistId;

    /**
     * 归档人姓名
     */
    @Column(name = "archivist_name")
    private String archivistName;

    /**
     * 设备厂家信息
     */
    @Column(name = "manufacturer_information")
    private String manufacturerInformation;

    /**
     * 备注信息
     */
    private String remarks;

    /**
     * 是否可用(0否1是)
     */
    @Column(name = "is_enabled")
    private String isEnabled;

    /**
     * 创建(归档)时间
     */
    @Column(name = "create_time")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private LocalDateTime createTime;

    /**
     * 删除标识(0否1是);测试阶段用逻辑删除方便
     */
    @Column(name = "is_delete")
    private String isDelete;

    /**
     * 服务站id
     */
    @Column(name = "station_id")
    private Integer stationId;

    /**
     * 服务站名称
     */
    @Column(name = "station")
    private String station;

    /**
     * 来邦老人id
     */
    @Column(name = "lb_userid")
    private String lbUserid;



}